var express = require('express');
var router = express.Router();
const conn = require('./db/conn');

/* GET users listing. */
router.get('/', function (req, res, next) {
  res.send('respond with a resource');
});


//查询老师信息
router.get('/teacher', function (req, res, next) {
  let sql = `select * from teacher`;
  conn.query(sql, (error, results) => {
    if (error) throw error;
    if (results.length) {
      res.send({ code: 0, success: true, msg: '获取数据成功', data: results });
    }
  })
});

module.exports = router;
